<?php
use Webman\Route;
Route::group('/user', function () {
    Route::get('/logout', [app\user\controller\UserController::class, 'logout']);           // 退出登陆
    Route::get('/off', [app\user\controller\UserController::class, 'writeOff']);            // 注销用户
    Route::post('/edit', [app\user\controller\UserController::class, 'editInfo']);          // 编辑信息

    // 解决 options 预检
    Route::options('/logout', [app\user\controller\UserController::class, 'logout']);           // 退出登陆
    Route::options('/off', [app\user\controller\UserController::class, 'writeOff']);            // 注销用户
    Route::options('/edit', [app\user\controller\UserController::class, 'editInfo']);          // 编辑信息
})->middleware([
//    \App\middleware\AllowAccessMiddle::class,
    \app\middleware\CheckUserLogin::class,
]);

Route::group('/user', function (){
    Route::post('/register', [app\user\controller\UserController::class, 'register']);      // 注册
    Route::post('/login', [app\user\controller\UserController::class, 'login']);         // 登陆
    Route::get('/code', [app\user\controller\UserController::class, 'sendCode']);           // 发送验证码

    // 解决 options 预检
    Route::options('/code', [app\user\controller\UserController::class, 'sendCode']);           // 发送验证码
    Route::options('/login', [app\user\controller\UserController::class, 'login']);           // 发送验证码
    Route::options('/register', [app\user\controller\UserController::class, 'register']);           // 发送验证码
});